/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package utiles;

import javax.swing.JProgressBar;
import org.apache.commons.net.io.CopyStreamAdapter;

/**
 *
 * @author Felipe
 */
public class ListenerProgreso extends CopyStreamAdapter
{
    private JProgressBar barra;
    
    public ListenerProgreso (JProgressBar barra)
    {
        this.barra = barra;
        
        barra.setValue(0);
    }
    
    @Override
    public void bytesTransferred(long totalBytesTransferred, int bytesTransferred, long streamSize) 
    {
        barra.setValue((int) (totalBytesTransferred));
    }
}
